package com.itheima.service;

import com.itheima.dto.DeleteDTO;
import com.itheima.dto.ShoppingCartDTO;
import com.itheima.entity.ShoppingCart;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 *购物车模块业务层实现接口
 * @author msi
 * @date 2022/5/17
 * @version 1.0
 */
@Transactional(rollbackFor =Exception.class )
public interface ShoppingService {
    /**
     * 添加购物车项
     * @param shoppingCartDTO 购物车商品项
     * @param userId
     * @return
     */
    ShoppingCart addDish(ShoppingCartDTO shoppingCartDTO, String userId);

    /**
     * 获得购物车列表
     * @param userId
     * @return
     */
    List<ShoppingCart> getList(String userId);

    /**
     * 清空购物车
     * @param userId
     */
    void clean(String userId);

    /**
     * 购物车项减和删除
     * @param deleteDTO 菜品id或套餐id
     * @param userId
     * @return
     */
    Integer delete(DeleteDTO deleteDTO, String userId);
}
